﻿using System.Collections.Generic;
using EnvDTE;
using Microsoft.VisualStudio.TemplateWizard;

namespace Headsight.BPMN2WF.ConversionWizard
{
    public class ProjectWizard : IWizard
    {
        public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
        {
            var bpmnFileDialog = new ChooseBPMNStep();
            bpmnFileDialog.ShowDialog();

            var content = bpmnFileDialog.WorkflowXamlContent;
            replacementsDictionary.Add("$workflowXamlContent$", (string.IsNullOrEmpty(content) ? "empty" : content));
        }

        public void ProjectFinishedGenerating(Project project)
        {
        }

        /// <summary>
        /// This method is only called for item templates, not for project templates.
        /// </summary>
        /// <param name="projectItem"></param>
        public void ProjectItemFinishedGenerating(ProjectItem projectItem)
        {
        }

        public bool ShouldAddProjectItem(string filePath)
        {
            return true;
        }

        /// <summary>
        /// This method is called before opening any item that has the OpenInEditor attribute.
        /// </summary>
        /// <param name="projectItem"></param>
        public void BeforeOpeningFile(ProjectItem projectItem)
        {
        }

        /// <summary>
        /// This method is called after the project is created.
        /// </summary>
        public void RunFinished()
        {
        }
    }
}
